

int led = 13;
int onModulePin = 2;        // the pin to switch on the module (without press on button)

int timesToSend = 1;        // Numbers of calls to make
int count = 0;
int tones = 5;                //Each tone has a duration of 6 seconds aprox.

char phone_number[]="653554133";     // ********* is the number to call

void switchModule(){
    digitalWrite(onModulePin,HIGH);
    delay(2000);
    digitalWrite(onModulePin,LOW);
}

void setup(){

    Serial.begin(115200);                // UART baud rate
    delay(2000);
    pinMode(led, OUTPUT);
    pinMode(onModulePin, OUTPUT);
    switchModule();                    // switches the module ON

    for (int i=0;i < 5;i++){
        delay(5000);
    } 
}

void loop(){

    while (count < timesToSend){
        

        Serial.print("ATD");     
        Serial.print(phone_number);     
        Serial.println(";");   
        delay(6000*tones);
        Serial.println("ATH");            // cancel the call

        delay(5000);

        count++;
    }
}
